package com.lck.vueblog.controller;


import com.lck.vueblog.common.Result;
import com.lck.vueblog.entity.User;
import com.lck.vueblog.service.UserService;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 关注公众号：MarkerHub
 * @since 2022-04-22
 */
@RestController
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @RequiresAuthentication
    @GetMapping("/index")
    public Result test(){
        return Result.success(200,"成功",userService.getById(1L));
    }
    @PostMapping("/save")
    public Result save(@Validated @RequestBody User user){
        return Result.success(user);
    }
}
